<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>打印</title>
    <style>
        body {
            margin: 0;
            padding: 0;
            font-size: 14px;
            background-color: #f1f3f4;
        }

        .blank {
            height: 30px;
        }

        div {
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        .content {
            margin: 15px;
        }
        .item {
            display: flex;
            align-items: center;
            padding: 15px 10px;
            margin-bottom: 10px;
            border-radius: 5px;
            background-color: #fff;
            justify-content: space-between;
            box-shadow: 0px 2px 6px rgba(0, 0, 0, 0.07);
        }
        .con-c {
            flex:1;
        }
        .con-r {
            display: flex;
            flex-direction: column;
            align-items: center;
            margin-right: 5px;
        }
        .qr-code {
            width: 120px;
            height: 120px;
        }
        .code-img {
            width: 100%;
            height: 100%;
        }
        .item-con {
            margin-bottom: 10px;
            font-size: 16px;
        }

        .item-con-title {
            color: #000000;
        }
    </style>
    <script src="js/qrcode.js"></script>
    <script type="text/javascript">
    function scanprint(){
        var datalistdiv = document.getElementById("show");
        window.connect.print(datalistdiv.offsetLeft, datalistdiv.offsetTop, datalistdiv.offsetWidth, datalistdiv.offsetHeight);
    }
    function feed(){
        window.connect.doFeed();
    }
    function getQrCode(codeid, id) {
        var qrcode = new QRCode(codeid, {
            text: id,
            width: 120,
            height: 120,
            colorDark: "#000000",
            colorLight: "#ffffff",
            correctLevel: QRCode.CorrectLevel.L
        });
    }
    function getLabel(jsonStr){
        var jsonObj = JSON.parse(jsonStr);
        var html = '';
        html = html + '<div class="blank">' + '</div>'
        html = html + '<div class="item">'
        html = html + '<div class="con-c">'
        html = html + '<div class="item-con">'
        html = html + '<span class="item-con-title">' + '编号：' + '</span>'
        html = html + '<span>' + jsonObj.code + '</span>'
        html = html + '</div>'
        html = html + '<div class="item-con">'
        html = html + '<span class="item-con-title">' + '医院：' + '</span>'
        html = html + '<span>' + jsonObj.hospitalBaseName + '</span>'
        html = html + '</div>'
        html = html + '<div class="item-con">'
        html = html + '<span class="item-con-title">' + '科室：' + '</span>'
        html = html + '<span>' + jsonObj.hospitalDepartName + '</span>'
        html = html + '</div>'
        html = html + '<div class="item-con">'
        html = html + '<span class="item-con-title">' + '类型：' + '</span>'
        html = html + '<span>' + jsonObj.wasteClassifyName + '</span>'
        html = html + '</div>'
        html = html + '</div>'
        html = html + '<div class="con-r">'
        html = html + '<div class="qr-code" id="qrcode">' +  '</div>'
        html = html + '</div>'
        html = html + '</div>'
        html = html + '<div class="blank">' + '</div>'
        document.getElementById('show').innerHTML = html
        // 生成二维码
		getQrCode('qrcode', jsonObj.content)
        // 执行打印
        scanprint();
    }

</script>

</head>



<body>
    <div class="content">
        <div class="aaa" id="show">
        </div>
    </div>
</body>

</html>